import { ThrowStmt } from '@angular/compiler';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core';
import { inject } from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';
import { ImageSlider, channel } from 'src/app/shared/components';
import { HomeService, token } from '../../service';

@Component({
  selector: 'app-home-detail',
  templateUrl: './home-detail.component.html',
  styleUrls: ['./home-detail.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
// tslint:disable
export class HomeDetailComponent implements OnInit {

  constructor(
    private router: ActivatedRoute,
    private servise: HomeService,
    @Inject(token) private baseUrl: string,
    private cd:ChangeDetectorRef
  ) { }


  selectedTabLink: string | null = "";
  /**
 * 轮播图数据
 */
  imageSliders: ImageSlider[] = [];
  /**
   * 图标栏数据
   */
  channels: channel[] = [];
  ngOnInit(): void {


    this.channels = this.servise.getChannels();
    this.imageSliders = this.servise.getImageSlider();


    this.router.paramMap.subscribe(param => {

      this.selectedTabLink = param.get('tabLink')
      this.cd.markForCheck();

    })


    this.router.queryParamMap.subscribe(_param => {
      // console.log(param.get('id'))
    })
    console.log(this.baseUrl)
  }
}
